package se.webbzon.oschi01.nbt;

import se.webbzon.oschi01.nbt.TagEvent.Action;

public class IntTag extends AbstractTag<Integer> {
	
	private int i;
	
	public IntTag(TagFactory<Integer> factory, String tagName, int i) {
		super(factory, tagName);
		this.i = i;
	}

	@Override public long size() {
		return 4;
	}

	@Override public Integer getValue() {
		return i;
	}

	@Override public void setValue(Integer value) {
		this.i = value;
		broadcastEvent(new TagEvent(this,Action.CHANGED,value));
	}

	@Override public Class<Integer> getValueClass() {
		return Integer.class;
	}

	@Override public IntTag clone() {
		return new IntTag(getFactory(),this.toString(),i);
	}

}
